cmake_minimum_required (VERSION 3.13)
project(DeviceDemo LANGUAGES CXX)

# 导入boost库
#find_package(Boost REQUIRED)
#if (Boost_FOUND)
#    include_directories(${Boost_INCLUDE_DIRS})
#    link_directories(${Boost_LIBRARY_DIRS})
#    add_definitions(${Boost_DEFINITIONS})
#    message(STATUS "found Boost ${Boost_VERSION} Library ${Boost_LIBRARIES}")
#endif (Boost_FOUND)

find_package(Boost 1.74.0 COMPONENTS thread log log_setup)
include_directories(${Boost_INCLUDE_DIRS})

# 导入opencv库
find_package(OpenCV REQUIRED)
if (OpenCV_FOUND)
    include_directories(${OpenCV_INCLUDE_DIRS})
    link_directories(${OpenCV_LIBRARY_DIRS})
    add_definitions(${OpenCV_DEFINITIONS})
    message(STATUS "found OpenCV ${OpenCV_VERSION} Library ${OpenCV_LIBRARIES}")
endif (OpenCV_FOUND)

# 导入pcl库
find_package(PCL REQUIRED)
if (PCL_FOUND)
    include_directories(${PCL_INCLUDE_DIRS})
    link_directories(${PCL_LIBRARY_DIRS})
    add_definitions(${PCL_DEFINITIONS})
    message(STATUS "found PCL ${PCL_VERSION} Library ${PCL_LIBRARIES}")
endif (PCL_FOUND)

# 导入MYDeviceSDK库
set(MYDeviceSDK_DIR "/home/hrl/MYdevicesdk/MYDeviceSDK")
find_package(MYDeviceSDK REQUIRED)
if (MYDeviceSDK_FOUND)
    include_directories(${MYDeviceSDK_INCLUDE_DIRS})
    link_directories(${MYDeviceSDK_LIBRARY_DIRS})
    add_definitions(${MYDeviceSDK_DEFINITIONS})
    message(STATUS "found MYDeviceSDK ${MYDeviceSDK_VERSION} Library ${MYDeviceSDK_LIBRARIES}")

    message("*****")
    message("MYDeviceSDK include ${MYDeviceSDK_INCLUDE_DIRS}")
    message("MYDeviceSDK link ${MYDeviceSDK_LIBRARY_DIRS}")
    message("MYDeviceSDK definitions ${MYDeviceSDK_DEFINITIONS}")
    message("MYDeviceSDK Library ${MYDeviceSDK_LIBRARIES}")
    message("MYDeviceSDK Library_dirs ${MYDeviceSDK_LIBRARY_DIRS}")
endif (MYDeviceSDK_FOUND)

# add_compile_options(-std=c++14)
# add_definitions(-std=c++14)

#add_definitions(-D _USRDLL)

#启动对C++14标准的支持
set(CMAKE_CXX_STANDARD 14)
# 显式要求指明支持C++标准
set(CMAKE_CXX_STANDARD_REQUIRED True)

# 添加头文件
# include_directories(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/proto/Generated)

# 添加源代码文件
# aux_source_directory(${PROJECT_SOURCE_DIR}/src PROJECT_SRCS)
add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp)

# 链接库
target_link_libraries(${PROJECT_NAME} 
    ${Boost_LIBRARIES}
    Boost::log
    Boost::log_setup
    ${OpenCV_LIBRARIES}
    ${PCL_LIBRARIES}
    ${MYDeviceSDK_LIBRARIES}
)

install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
